﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CourseUtils;

namespace creditCalculator
{
    class Program
    {
        public static DateTime ReadDateFromConsole(String displayText)
        {
            Console.WriteLine(displayText);

            int year = IOHelpers.ReadIntFromConsole("Enter the year:");
            int month = IOHelpers.ReadIntFromConsole("Enter the month number:");
            int day = IOHelpers.ReadIntFromConsole("Enter the day:");

            return new DateTime(year, month, day);
        }


        static void Main(string[] args)
        {
            DateTime birthDay = ReadDateFromConsole("Please enter your birthday");

            DateTime possibleLimit = birthDay.AddYears(100);

            int mondays = 0;
            int tuesdays = 0;
            int wednesdays = 0;
            int thursdays = 0;
            int fridays = 0;
            int saturdays = 0;
            int sundays = 0;

            while (birthDay <= possibleLimit)
            {
                switch (birthDay.DayOfWeek)
                {
                    case DayOfWeek.Friday:
                        fridays++;
                        break;
                    case DayOfWeek.Monday:
                        mondays++;
                        break;
                    case DayOfWeek.Saturday:
                        saturdays++;
                        break;
                    case DayOfWeek.Sunday:
                        sundays++;
                        break;
                    case DayOfWeek.Thursday:
                        thursdays++;
                        break;
                    case DayOfWeek.Tuesday:
                        tuesdays++;
                        break;
                    case DayOfWeek.Wednesday:
                        wednesdays++;
                        break;
                    default:
                        break;
                }

                birthDay = birthDay.AddYears(1);
            }

            int maximum = 0;
            String preliminaryAnswer = "Unknown";

            if (mondays > maximum)
            {
                preliminaryAnswer = "Mondays";
                maximum = mondays;
            }
            if (tuesdays > maximum)
            {
                preliminaryAnswer = "Tuesdays";
                maximum = tuesdays;
            }
            if (wednesdays > maximum)
            {
                preliminaryAnswer = "Wednesdays";
                maximum = wednesdays;
            }
            if (thursdays > maximum)
            {
                preliminaryAnswer = "thursdays";
                maximum = thursdays;
            }
            if (fridays > maximum)
            {
                preliminaryAnswer = "fridays";
                maximum = fridays;
            }
            if (saturdays > maximum)
            {
                preliminaryAnswer = "saturdays";
                maximum = saturdays;
            }
            if (sundays > maximum)
            {
                preliminaryAnswer = "sundays";
                maximum = sundays;
            }

            Console.WriteLine(mondays);
            Console.WriteLine(thursdays);
            Console.WriteLine(wednesdays);
            Console.WriteLine(thursdays);
            Console.WriteLine(fridays);
            Console.WriteLine(saturdays);
            Console.WriteLine(sundays);


            Console.WriteLine("Most frequest birthday day of week is {0}", preliminaryAnswer);
            Console.ReadKey();
        }
    }
}
        